﻿/*
 * Returns a new datetime at the specified year, month, day, hour, minute and second.
 */
create function [DateTime].[FromParts] ( @p_Year int, @p_Month int, @p_Day int, @p_Hour int, @p_Minute int, @p_Second int )
returns datetime as
begin

  return Convert( DateTime, Date.FromParts( @p_Year, @p_Month, @p_Day ) ) + Convert( DateTime, Time.FromParts( @p_Hour, @p_Minute, @p_Second ) );

end